package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/13 21:56
 **/
public class Offer14_Ⅱ {
    class Solution {
        public int cuttingRope(int n) {
            if(n < 4) return n-1;
            long ans = 1;
            while(n > 4){
                ans = (ans * 3) % 1000000007;
                n -= 3;
            }
            return (int)((ans * n) % 1000000007);
        }
    }
}